package com.example.cofeed.adapter;

import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.cofeed.R;

/**
 * author by mqwang
 * date 2018/7/20
 */
public class SelectPhotoAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    public SelectPhotoAdapter() {
        super(R.layout.item_select_photo);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {

        if (helper.getAdapterPosition() == getItemCount() - 1) {
            helper.setImageResource(R.id.iv_iamge, R.mipmap.addtimg);
            helper.itemView.findViewById(R.id.iv_delete).setVisibility(View.GONE);
//            helper.setText(R.id.tv_count, getItemCount() - 1 + "/9");
        } else {
            helper.itemView.findViewById(R.id.iv_delete).setVisibility(View.VISIBLE);
            Glide.with(mContext).load(item).into((ImageView) helper.itemView.findViewById(R.id.iv_iamge));
//            helper.setText(R.id.tv_count, "");

        }

        helper.addOnClickListener(R.id.iv_delete);

    }

}
